import { Component, OnInit } from '@angular/core';
import { _HttpClient } from '@delon/theme';
import {ActivatedRoute, Router} from '@angular/router';
import {HttpClient} from '@angular/common/http';
import {AppUrl} from '../../../app.url';

@Component({
  selector: 'app-group-detail',
  templateUrl: './group-detail.component.html',
    styleUrls: [ './group-detail.component.less'],
})
export class GroupDetailComponent implements OnInit {

    groupList = {
        univName: 'xxx大学xxx部门' ,
        campName:'',
        introduce:'',
        campusType:'',
        campusLevel:'',
        campusScale:'',
        campTotalAct:'',
        campTotalActMoney:'',
    };

    activityList =[];

    studentList = [];

    otherCampList =[];

    slides = [
        {
            image: 'assets/img/1.png',
        },
        {
            image: 'assets/img/2.png',
        },
        {
            image: 'assets/img/3.png',
        },
        {
            image: 'assets/img/4.png',
        }
    ];
    campId;
    constructor(
        private http: HttpClient,private route: ActivatedRoute, private router: Router,
    ) {
        this.campId = this.route.snapshot.paramMap.get('id');

        this.http.post(AppUrl.campus.campDetByCampID, {campId: this.campId }).subscribe(data => {
            console.log(data);
            let temp: any = data;
            // this.groupList = temp.data;
            this.groupList.univName= temp.data.univName ;
            this.groupList.campName= temp.data.campusName ;
            this.groupList.introduce= temp.data.introduce ;
                this.groupList.campusType = temp.data.campusType;
                this.groupList. campusLevel = temp.data.campusLevel;
                this.groupList.campusScale = temp.data.campusScale;
                this.groupList.campTotalAct = temp.data.campTotalAct;
                this.groupList. campTotalActMoney = temp.data.campTotalActMoney
        });

        this.http.post(AppUrl.student.studentByCampID, {campId: this.campId }).subscribe(data => {
            console.log(data);
            let temp: any = data;
            this.studentList = temp.data;
        });

        this.http.post(AppUrl.activity.selectActListByCampId, {campId: this.campId }).subscribe(data => {
            console.log(data);
            let temp: any = data;
            this.activityList = temp.data;
        });

        this.http.post(AppUrl.campus.othherCampByCampID, {campId: this.campId }).subscribe(data => {
            console.log(data);
            let temp: any = data;
            this.otherCampList = temp.data;
        });

    }

    ngOnInit() {
    }

}
